home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / javax / swing / MenuElement.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  2.3 KB  |  71 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)MenuElement.java    1.6 98/08/26
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14. package javax.swing;
  15.  
  16. import java.awt.*;
  17. import java.awt.event.*;
  18.  
  19. /**
  20.  * Any component that can be placed into a menu should implement this interface.
  21.  * This interface is used by MenuSelection to handle selection and navigation in
  22.  * menu hierarchies.
  23.  *
  24.  * @version 1.6 08/26/98
  25.  * @author Arnaud Weber
  26.  */
  27.  
  28. public interface MenuElement {
  29.     
  30.     /**
  31.      * Process a mouse event. event is a MouseEvent with source being the receiving element's component.
  32.      * path is the path of the receiving element in the menu
  33.      * hierarchy including the receiving element itself.
  34.      * manager is the MenuSelectionManager for the menu hierarchy.
  35.      * This method should process the MouseEvent and change the menu selection if necessary
  36.      * by using MenuSelectionManager's API
  37.      * Note: you do not have to forward the event to sub-components. This is done automatically
  38.      * by the MenuSelectionManager
  39.      */
  40.     public void processMouseEvent(MouseEvent event,MenuElement path[],MenuSelectionManager manager);
  41.  
  42.  
  43.     /**
  44.      *  Process a key event. 
  45.      */
  46.     public void processKeyEvent(KeyEvent event,MenuElement path[],MenuSelectionManager manager);
  47.  
  48.     /**
  49.      * Call by the MenuSelection when the MenuElement is added or remove from 
  50.      * the menu selection.
  51.      */
  52.     public void menuSelectionChanged(boolean isIncluded);
  53.  
  54.     /**
  55.      * This method should return an array containing the sub-elements for the receiving menu element
  56.      *
  57.      * @return an array of MenuElements
  58.      */
  59.     public MenuElement[] getSubElements();
  60.     
  61.     /**
  62.      * This method should return the java.awt.Component used to paint the receiving element.
  63.      * The returned component will be used to convert events and detect if an event is inside
  64.      * a MenuElement's component.
  65.      *
  66.      * @return the Component value
  67.      */
  68.     public Component getComponent();
  69. }
  70.  
  71.